<?php

namespace App\Models\GameServer;

use Illuminate\Database\Eloquent\Model;

class ChangeRecord extends Model
{
    protected $table = 'jeton_change_record';
    protected $primaryKey = 'id';
    protected $connection = 'game_server';

    protected $reason = [
        0 => '充值',
        1 => '下注',
        2 => '取消下注',
        3 => '游戏结算',
        4 => '获取筹码命令',
        5 => '登录奖励',
        6 => '新手任务',
        7 => '每日任务奖励',
        8 => '成就任务奖励',
        9 => '日榜奖励',
        10 => '周榜奖励',
        11 => '邮件',
        12 => '分享奖励',
        13 => '购买物品',
        14 => '其他奖励',
        15 => '输光补偿',
        16 => '注册赠送'
    ];

    public function getReasonAttribute($value)
    {
        $reason = $this->reason[$value] ?? $this->reason[14];

        return $reason . $this->attributes['amount'] . '筹码';
    }
}
